package org.osomit.sacct.security.otp.impl;

import org.osomit.sacct.security.otp.iface.OTPProfileRegistry;

import java.util.Map;
import java.util.HashMap;
import java.util.Collection;

/**
 * Keep the OTP Profile in memory
 *
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Jun 26, 2009
 */
public class InMemoryOTPProfileRegistry implements OTPProfileRegistry {

  private final Map<String, OTPProfile> registry = new HashMap<String, OTPProfile>();

	public void addOTPProfile(OTPProfile profile) {

		 registry.put(profile.getSN(), profile);
	}

	public OTPProfile getOTPProfile(String profileSN) {

		return registry.get(profileSN);
	}

	public Collection<OTPProfile> getOTPProfiles() {

		return registry.values();
	}

	public void updateOTPProfile(OTPProfile profile) {

		registry.put(profile.getSN(), profile);
	}
}
